/*
 * @Author: zeki mini
 * @Date: 2021-03-30 15:32:08
 * @LastEditors: 汪滔
 * @LastEditTime: 2021-08-11 11:51:49
 * @Description: 司机封禁
 */
import React from 'react';
import {
  View,
  StyleSheet,
  Image,
  Text,
  TouchableOpacity
} from 'react-native';

import {
  mainBgColorWhite,
  px2dp,
  fontColorSecDeepGray,

} from '@/styles';
import { msg } from '@/common';

export default class InsuranceEntrance extends React.PureComponent {
  render() {
    const { driverCerStatus } = this.props;
    return (
      <TouchableOpacity
        style={styles.wrap}
        activeOpacity={0.8}
        onPress={() => {
          this.goTo();
        }}
      >
        <View style={styles.left}>
          <Text style={styles.title}>水印相机</Text>
          <View style={styles.bottom}>
            <Text style={styles.desc}>路况报备 货运专用</Text>
            <View style={styles.goBtn}>
              <Text style={styles.goText}>
                {'GO >'}
              </Text>
            </View>
          </View>
        </View>
        <Image source={require('@/images/insurance/camera_entrance.png')} style={styles.insuranceEntranceImg} resizeMode='contain' />
      </TouchableOpacity>
    );
  }

  // 去哪里
  goTo = () => {
    const { driverCerStatus, driverCerData } = this.props;
    if (driverCerStatus === 2) {
      msg.emit('router: goToNext', {
        routeName: 'WatermarkCameraView',
      });
      return;
    }
    msg.emit('app:messageBox', {
      isVisible: true,
      title: '提示',
      text: '请完成司机认证',
      okText: '确定',
    });
  };
}
const styles = StyleSheet.create({
  wrap: {
    width: px2dp(702),
    height: px2dp(140),
    backgroundColor: mainBgColorWhite,
    borderRadius: px2dp(16),
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    paddingHorizontal: px2dp(40),
    marginTop: px2dp(24)
  },

  bottom: {
    flexDirection: 'row',
    alignItems: 'center'
  },
  title: {
    fontSize: px2dp(36),
    fontWeight: 'bold'
  },
  desc: {
    fontSize: px2dp(28),
    color: fontColorSecDeepGray
  },
  insuranceEntranceImg: {
    width: px2dp(210),
    height: px2dp(100),
  },
  goBtn: {
    width: px2dp(70),
    height: px2dp(30),
    borderRadius: px2dp(15),
    backgroundColor: '#FF6B44',
    marginLeft: px2dp(12)
  },
  goText: {
    color: mainBgColorWhite,
    fontSize: px2dp(20),
    textAlign: 'center'
  }
});
